/***********************************************************************
* @file           LCD.c
* @author         ZhaoYun(ZFSZDZ)
* @date           2024.10.12
* @Version        V1.0.0
* @description    LCD�1�7�1�7�0�5�0�1�1�7�1�7�1�7�0�4�1�7 
***********************************************************************/
#include "LCD.h"

/**
************************************************************************
* @brief:      	LCD_Writ_Bus: LCD�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�Մ1�7�1�8�1�7�1�7
* @param:      	dat - �0�8�Մ1�7�1�7�0�6�1�7�1�7�1�7�1�7�1�7�1�7�1�7
* @retval:     	void
* @details:    	�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�Մ1�7�1�7LCD
************************************************************************
**/
void LCD_Writ_Bus(unsigned char dat)
{
    LCD_CS_Clr();
    
    while((SPI1->SR & 0x00000080) != 0){};
    *((__IO uint8_t *)&SPI1->DR) = dat; 
    while((SPI1->SR & 0x00000080) != 0){};
    
    LCD_CS_Set();
}
/**
************************************************************************
* @brief:      	LCD_WR_DATA8: �1�7�1�7LCD�Մ1�7�1�78�˄1�7�1�7�1�7�1�7
* @param:      	dat - �0�8�Մ1�7�1�7�1�78�˄1�7�1�7�1�7�1�7
* @retval:     	void
* @details:    	�1�7�1�7�1�7�1�7LCD_Writ_Bus�1�7�1�7�1�7�1�7�1�7�1�78�˄1�7�1�7�1�7�1�7�Մ1�7�1�7LCD�1�7�1�7
************************************************************************
**/
void LCD_WR_DATA8(unsigned char dat)
{
    LCD_Writ_Bus(dat);
}
/**
************************************************************************
* @brief:      	LCD_WR_DATA: �1�7�1�7LCD�Մ1�7�1�716�˄1�7�1�7�1�7�1�7
* @param:      	dat - �0�8�Մ1�7�1�7�1�716�˄1�7�1�7�1�7�1�7
* @retval:     	void
* @details:    	�1�7�1�7�1�7�1�7LCD_Writ_Bus�1�7�1�7�1�7�1�7�1�7�1�716�˄1�7�1�7�1�7�1�3�0�0�1�78�˄1�7�0�3�1�78�˄1�7�0�1�1�7�Մ1�7�1�7LCD�1�7�1�7
************************************************************************
**/
void LCD_WR_DATA(unsigned short dat)
{
    LCD_Writ_Bus(dat >> 8);
    LCD_Writ_Bus(dat);
}
/**
************************************************************************
* @brief:      	LCD_WR_REG: �1�7�1�7LCD�Մ1�7�1�7�0�6�1�7�1�7�1�7�1�7�1�7�0�7
* @param:      	dat - �0�8�Մ1�7�1�7�0�4�0�6�1�7�1�7�1�7�1�7�1�7�0�7
* @retval:     	void
* @details:    	�0�0�1�7�1�7�1�7�1�7�1�7�1�7LCD_Writ_Bus�1�7�1�7�1�7�1�7�1�7�1�7LCD�Մ1�7�1�7�0�6�1�7�1�7�1�7�1�7�1�7�0�7�1�7�1�7
************************************************************************
**/
void LCD_WR_REG(unsigned char dat)
{
    LCD_DC_Clr();//�Մ1�7�1�7�1�7�1�7
    LCD_Writ_Bus(dat);
    LCD_DC_Set();//�Մ1�7�1�7�1�7�1�7
}
/**
************************************************************************
* @brief:      	LCD_Address_Set: �1�7�1�7�1�7�1�7LCD�1�7�1�7�0�5�1�7�1�7�1�7�1�7�0�7�1�7�0�7�1�7�1�7��
* @param:      	x1, y1, x2, y2 - �1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�1�0�1�1�7�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7
* @retval:     	void
* @details:    	�1�7�1�7�1�7�1�7�1�7�1�7�0�3�1�7�1�7�1�7�1�7�0�0�1�7�1�7�1�7�1�7�1�7�1�7LCD_WR_REG�1�7�1�7LCD_WR_DATA�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7LCD�1�7�1�7�1�7�ք1�7�0�7�1�7�1�7�1�7�ք1�7�0�7�1�7�1�7�0�6�1�7�1�7�Մ1�7�1�1�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�5�1�7�1�7
************************************************************************
**/
void LCD_Address_Set(unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2)
{
    if(USE_HORIZONTAL == 0)
    {
        LCD_WR_REG(0x2a);//�1�7�ք1�7�0�7�1�7�1�7�1�7�1�7
        LCD_WR_DATA(x1 + 52);
        LCD_WR_DATA(x2 + 52);
        LCD_WR_REG(0x2b);//�1�7�ք1�7�0�7�1�7�1�7�1�7�1�7
        LCD_WR_DATA(y1 + 40);
        LCD_WR_DATA(y2 + 40);
        LCD_WR_REG(0x2c);//�1�7�1�7�1�7�1�7�1�7�1�7��
    }
    else if(USE_HORIZONTAL == 1)
    {
        LCD_WR_REG(0x2a);//�1�7�ք1�7�0�7�1�7�1�7�1�7�1�7
        LCD_WR_DATA(x1 + 53);
        LCD_WR_DATA(x2 + 53);
        LCD_WR_REG(0x2b);//�1�7�ք1�7�0�7�1�7�1�7�1�7�1�7
        LCD_WR_DATA(y1 + 40);
        LCD_WR_DATA(y2 + 40);
        LCD_WR_REG(0x2c);//�1�7�1�7�1�7�1�7�1�7�1�7��
    }
    else if(USE_HORIZONTAL == 2)
    {
        LCD_WR_REG(0x2a);//�1�7�ք1�7�0�7�1�7�1�7�1�7�1�7
        LCD_WR_DATA(x1 + 40);
        LCD_WR_DATA(x2 + 40);
        LCD_WR_REG(0x2b);//�1�7�ք1�7�0�7�1�7�1�7�1�7�1�7
        LCD_WR_DATA(y1 + 53);
        LCD_WR_DATA(y2 + 53);
        LCD_WR_REG(0x2c);//�1�7�1�7�1�7�1�7�1�7�1�7��
    }
    else
    {
        LCD_WR_REG(0x2a);//�1�7�ք1�7�0�7�1�7�1�7�1�7�1�7
        LCD_WR_DATA(x1 + 40);
        LCD_WR_DATA(x2 + 40);
        LCD_WR_REG(0x2b);//�1�7�ք1�7�0�7�1�7�1�7�1�7�1�7
        LCD_WR_DATA(y1 + 52);
        LCD_WR_DATA(y2 + 52);
        LCD_WR_REG(0x2c);//�1�7�1�7�1�7�1�7�1�7�1�7��
    }
}
/**
************************************************************************
* @brief:      	LCD_Fill: �1�7�1�7LCD�0�8�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�8�1�7�1�7�1�7�1�7�0�2
* @param:      	xsta, ysta, xend, yend - �1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�1�0�1�1�7�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7
*              	color - �1�7�1�7�1�7�1�7�1�7�0�2
* @retval:     	void
* @details:    	�0�0�1�7�1�7�1�7�1�7�1�7�1�7LCD_Address_Set�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7LCD�1�7�1�7�0�5�1�7�1�7�1�7�1�7�0�7�1�7�0�7�1�7�1�7���1�7�1�7�0�6�1�7�1�7�1�7�1�4�1�7���1�7�1�7�1�7�1�7�1�7�0�8�1�7�1�7�1�7�1�7�0�2�1�7�1�7
************************************************************************
**/
void LCD_Fill(unsigned short xsta, unsigned short ysta, unsigned short xend, unsigned short yend, unsigned short color)
{
    unsigned short i, j;
    LCD_Address_Set(xsta, ysta, xend - 1, yend - 1); //�1�7�1�7�1�7�1�7�1�7�1�7�0�5�1�7�1�7��

    for(i = ysta; i < yend; i++)
    {
        for(j = xsta; j < xend; j++)
        {
            LCD_WR_DATA(color);
        }
    }
    Delay_ms(100);
}
/**
************************************************************************
* @brief:      	LCD_DrawPoint: �1�7�1�7LCD�0�8�1�7�1�7�˄1�7�0�4�1�7�1�7�1�7
* @param:      	x, y - �1�7�1�7�1�7�1�7�1�7�1�7�1�7
*              	color - �1�7�1�7�1�7�1�7�1�7�0�2
* @retval:     	void
* @details:    	�0�0�1�7�1�7�1�7�1�7�1�7�1�7LCD_Address_Set�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7LCD�1�7�1�7�0�5�1�7�1�7�1�7�1�7�0�7�1�7�0�7�1�7�1�7���1�7�1�7�0�6�1�7�1�7�1�7�1�7�0�8�1�7�1�7�˄1�7�0�4�1�7�1�7�0�4�1�7�1�7�0�2�1�7�1�7color�1�7�1�7�1�7�1�7�0�8�1�7�1�7�1�7�1�7
************************************************************************
**/
void LCD_DrawPoint(unsigned short x, unsigned short y, unsigned short color)
{
    LCD_Address_Set(x, y, x, y); //�1�7�1�7�1�7���1�7�1�7�˄1�7�1�7
    LCD_WR_DATA(color);
}
/**
************************************************************************
* @brief:      	LCD_DrawLine: �1�7�1�7LCD�1�7�0�9�1�7�1�7�1�7
* @param:      	x1, y1 - �1�7�1�1�1�7�1�7�1�7�0�3�1�7�1�7�1�7�1�7
*              	x2, y2 - �1�7�1�1�0�5�1�7�1�7�1�7�1�7�1�7�1�7�1�7
*              	color - �1�7�1�1�1�7�1�7�1�7�0�2
* @retval:     	void
* @details:    	�0�0�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�4�4�1�7�1�7�1�7�1�7�0�3�1�7�1�7�1�7�7�6�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�2�2�1�7�1�3�1�7�1�7�1�7�0�2�1�7�1�7color�1�7�1�7�1�7�1�7�0�8�1�7�1�7�1�7�1�7
************************************************************************
**/
void LCD_DrawLine(unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, unsigned short color)
{
    unsigned short t;
    int xerr = 0, yerr = 0, delta_x, delta_y, distance;
    int incx, incy, uRow, uCol;
    delta_x = x2 - x1; //�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7
    delta_y = y2 - y1;
    uRow = x1; //�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7
    uCol = y1;

    if(delta_x > 0)incx = 1; //�1�7�1�7�1�7�0�1�1�7�1�7�1�7�1�7�1�7�1�7�1�7
    else if (delta_x == 0)incx = 0; //�1�7�1�7�0�1�1�7�1�7
    else
    {
        incx = -1;
        delta_x = -delta_x;
    }

    if(delta_y > 0)incy = 1;
    else if (delta_y == 0)incy = 0; //�0�8�0�9�1�7�1�7
    else
    {
        incy = -1;
        delta_y = -delta_y;
    }

    if(delta_x > delta_y)distance = delta_x; //�0�5�0�0�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7
    else distance = delta_y;

    for(t = 0; t < distance + 1; t++)
    {
        LCD_DrawPoint(uRow, uCol, color); //�1�7�1�7�1�7�1�7
        xerr += delta_x;
        yerr += delta_y;

        if(xerr > distance)
        {
            xerr -= distance;
            uRow += incx;
        }

        if(yerr > distance)
        {
            yerr -= distance;
            uCol += incy;
        }
    }
}
/**
************************************************************************
* @brief:      	LCD_DrawRectangle: �1�7�1�7LCD�1�7�0�9�1�7�1�7�1�7�1�7�1�7
* @param:      	x1, y1 - �1�7�1�7�1�7�ń1�7�1�7�1�7�1�7�0�1�1�7�1�7�1�7�1�7�1�7
*              	x2, y2 - �1�7�1�7�1�7�ń1�7�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7
*              	color - �1�7�1�7�1�7�ń1�7�1�7�1�7�0�2
* @retval:     	void
* @details:    	�0�0�1�7�1�7�1�7�1�7�1�7�1�7LCD_DrawLine�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�ń1�7�1�7�1�7�1�7�1�7�1�7�1�3�1�7�1�7�1�7�0�2�1�7�1�7color�1�7�1�7�1�7�1�7�0�8�1�7�1�7�1�7�1�7
************************************************************************
**/
void LCD_DrawRectangle(unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, unsigned short color)
{
    LCD_DrawLine(x1, y1, x2, y1, color);
    LCD_DrawLine(x1, y1, x1, y2, color);
    LCD_DrawLine(x1, y2, x2, y2, color);
    LCD_DrawLine(x2, y1, x2, y2, color);
}
/**
************************************************************************
* @brief:      	Draw_Circle: �1�7�1�7LCD�1�7�0�9�1�7�0�4
* @param:      	x0, y0 - �0�4�1�7�1�7�1�7�1�7�1�7�1�7
*              	r - �0�4�1�7�0�2�1�1
*              	color - �0�4�1�7�1�7�1�7�1�7�0�2
* @retval:     	void
* @details:    	�0�0�1�7�1�7�1�7�ւ2�2�0�4�1�7�1�7�1�7�1�7�1�7�1�7�0�4�1�7�1�7(x0, y0)�0�2�1�7�1�7�1�7�0�0�1�7�1�7�1�1�0�2r�1�7�1�7�1�7�1�7LCD�1�7�0�9�1�7�1�7�1�7�0�4�1�7�1�7
*              	�1�7�1�7�0�2�1�7�1�7color�1�7�1�7�1�7�1�7�0�8�1�7�1�7�1�7�1�7
************************************************************************
**/
void Draw_Circle(unsigned short x0, unsigned short y0, unsigned char r, unsigned short color)
{
    int a, b;
    a = 0;
    b = r;

    while(a <= b)
    {
        LCD_DrawPoint(x0 - b, y0 - a, color);       //3
        LCD_DrawPoint(x0 + b, y0 - a, color);       //0
        LCD_DrawPoint(x0 - a, y0 + b, color);       //1
        LCD_DrawPoint(x0 - a, y0 - b, color);       //2
        LCD_DrawPoint(x0 + b, y0 + a, color);       //4
        LCD_DrawPoint(x0 + a, y0 - b, color);       //5
        LCD_DrawPoint(x0 + a, y0 + b, color);       //6
        LCD_DrawPoint(x0 - b, y0 + a, color);       //7
        a++;

        if((a * a + b * b) > (r * r)) //�1�7�؄1�7�0�8�1�7�1�7�1�7�0�7�1�7�1�7�0�9�1�7�1�7�0�8
        {
            b--;
        }
    }
}
/**
************************************************************************
* @brief:      	LCD_ShowChinese: �1�7�1�7LCD�1�7�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7�0�7�1�7�1�7�1�7
* @param:      	x, y - �1�7�1�7�0�3�1�7�1�7�1�7�6�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7�0�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�1�1�7�1�7�1�7�1�7�1�7
*              	s - �0�8�1�7�1�7�0�5�1�7�0�2�1�7�1�7�1�7�1�7�0�7�1�7�1�7�1�7�1�7�1�7�0�7�1�7�1�7�1�7�1�7�1�7�1�7�0�8�1�7�1�7�1�7�1�7�1�7�0�3�1�7
*              	fc - �1�7�1�7�1�7�1�7�1�7�1�7�0�2
*              	bc - �1�7�1�7�1�7�1�7�1�7�1�7�0�2
*              	sizey - �1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7���1�7�1�7�0�1�1�7�1�712x12�1�7�1�716x16�1�7�1�724x24�1�7�1�732x32
*              	mode - �1�7�1�7�0�5�0�0�0�4�1�7�1�71�1�7�1�7�0�5�1�7�1�7�0�2�1�7�1�70�1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7�1�7�0�5
* @retval:     	void
* @details:    	�1�7�1�7�1�7�1�7sizey�0�5�1�7�1�7�1�7�1�7�1�7�1�7�1�7���1�7�1�7�1�7�1�7LCD�1�7�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7�0�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�0�5�0�0�0�4�1�7�1�7
************************************************************************
**/
void LCD_ShowChinese(unsigned short x, unsigned short y, unsigned char *s, unsigned short fc, unsigned short bc, unsigned char sizey, unsigned char mode)
{
    while(*s != 0)
    {
        if(sizey == 12) LCD_ShowChinese12x12(x, y, s, fc, bc, sizey, mode);
        else if(sizey == 16) LCD_ShowChinese16x16(x, y, s, fc, bc, sizey, mode);
        else if(sizey == 24) LCD_ShowChinese24x24(x, y, s, fc, bc, sizey, mode);
        else if(sizey == 32) LCD_ShowChinese32x32(x, y, s, fc, bc, sizey, mode);
        else return;

        s += 2;
        x += sizey;
    }
}
/**
************************************************************************
* @brief:      	LCD_ShowChinese12x12: �1�7�1�7LCD�1�7�1�7�1�7�1�7�0�512x12�1�7�1�7�1�7�1�7
* @param:      	x, y - �1�7�1�7�0�3�1�7�1�7�1�7�6�7�1�7�1�7�0�5�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�0�1�1�7�1�7�1�7�1�7�1�7
*              	s - �0�8�1�7�1�7�0�5�1�7�0�2�1�7�1�7�0�7�1�7�0�7�1�7�1�7�1�7�1�7�1�7�1�7�0�8�1�7�1�7�1�7�1�7�1�7�0�3�1�7
*              	fc - �1�7�1�7�1�7�1�7�1�7�1�7�0�2
*              	bc - �1�7�1�7�1�7�1�7�1�7�1�7�0�2
*              	sizey - �1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7���1�7�1�7�0�1�1�7�1�712x12
*              	mode - �1�7�1�7�0�5�0�0�0�4�1�7�1�71�1�7�1�7�0�5�1�7�1�7�0�2�1�7�1�70�1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7�1�7�0�5
* @retval:     	void
* @details:    	�1�7�1�7LCD�1�7�1�7�1�7�1�7�0�512x12�1�7�1�7�1�7�0�7�1�7�1�7�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�0�5�0�0�0�4�1�7�1�7
************************************************************************
**/
void LCD_ShowChinese12x12(unsigned short x, unsigned short y, unsigned char *s, unsigned short fc, unsigned short bc, unsigned char sizey, unsigned char mode)
{
    unsigned char i, j, m = 0;
    unsigned short k;
    unsigned short HZnum;//�1�7�1�7�1�7�1�7�1�7�1�7�0�7
    unsigned short TypefaceNum;//�0�5�1�7�1�7�1�7�0�7�1�7�1�7�1�7�0�8�1�7�0�3�1�0�1�7��
    unsigned short x0 = x;
    TypefaceNum = (sizey / 8 + ((sizey % 8) ? 1 : 0)) * sizey;

    HZnum = sizeof(tfont12) / sizeof(typFNT_GB12);	//�0�1�1�7�0�6�1�7�1�7�1�7�1�7�1�7�0�7

    for(k = 0; k < HZnum; k++)
    {
        if((tfont12[k].Index[0] == *(s)) && (tfont12[k].Index[1] == *(s + 1)))
        {
            LCD_Address_Set(x, y, x + sizey - 1, y + sizey - 1);

            for(i = 0; i < TypefaceNum; i++)
            {
                for(j = 0; j < 8; j++)
                {
                    if(!mode)//�1�7�0�7�1�7�1�7�0�5�1�7�0�4
                    {
                        if(tfont12[k].Msk[i] & (0x01 << j))LCD_WR_DATA(fc);
                        else LCD_WR_DATA(bc);

                        m++;

                        if(m % sizey == 0)
                        {
                            m = 0;
                            break;
                        }
                    }
                    else//�1�7�1�7�1�7�0�5�1�7�0�4
                    {
                        if(tfont12[k].Msk[i] & (0x01 << j))	LCD_DrawPoint(x, y, fc); //�1�7�1�7�0�5�1�7�1�7�1�7�1�7

                        x++;

                        if((x - x0) == sizey)
                        {
                            x = x0;
                            y++;
                            break;
                        }
                    }
                }
            }
        }

        continue;  //�1�7�1�7�1�7�0�9�1�7�1�7�1�7�0�8�1�7�1�7�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7�1�7�0�3�1�7�1�7�1�7�1�7�1�7�0�9�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�6�1�7�0�0�0�0�1�7�1�7�1�7�1�7�0�8�1�7�1�7
    }
}
/**
************************************************************************
* @brief:      	LCD_ShowChinese16x16: �1�7�1�7LCD�1�7�1�7�1�7�1�7�0�516x16�1�7�1�7�1�7�1�7
* @param:      	x, y - �1�7�1�7�0�3�1�7�1�7�1�7�6�7�1�7�1�7�0�5�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�0�1�1�7�1�7�1�7�1�7�1�7
*              	s - �0�8�1�7�1�7�0�5�1�7�0�2�1�7�1�7�0�7�1�7�0�7�1�7�1�7�1�7�1�7�1�7�1�7�0�8�1�7�1�7�1�7�1�7�1�7�0�3�1�7
*              	fc - �1�7�1�7�1�7�1�7�1�7�1�7�0�2
*              	bc - �1�7�1�7�1�7�1�7�1�7�1�7�0�2
*              	sizey - �1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7���1�7�1�7�0�1�1�7�1�716x16
*              	mode - �1�7�1�7�0�5�0�0�0�4�1�7�1�71�1�7�1�7�0�5�1�7�1�7�0�2�1�7�1�70�1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7�1�7�0�5
* @retval:     	void
* @details:    	�1�7�1�7LCD�1�7�1�7�1�7�1�7�0�516x16�1�7�1�7�1�7�0�7�1�7�1�7�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�0�5�0�0�0�4�1�7�1�7
************************************************************************
**/
void LCD_ShowChinese16x16(unsigned short x, unsigned short y, unsigned char *s, unsigned short fc, unsigned short bc, unsigned char sizey, unsigned char mode)
{
    unsigned char i, j, m = 0;
    unsigned short k;
    unsigned short HZnum;//�1�7�1�7�1�7�1�7�1�7�1�7�0�7
    unsigned short TypefaceNum;//�0�5�1�7�1�7�1�7�0�7�1�7�1�7�1�7�0�8�1�7�0�3�1�0�1�7��
    unsigned short x0 = x;
    TypefaceNum = (sizey / 8 + ((sizey % 8) ? 1 : 0)) * sizey;
    HZnum = sizeof(tfont16) / sizeof(typFNT_GB16);	//�0�1�1�7�0�6�1�7�1�7�1�7�1�7�1�7�0�7

    for(k = 0; k < HZnum; k++)
    {
        if ((tfont16[k].Index[0] == *(s)) && (tfont16[k].Index[1] == *(s + 1)))
        {
            LCD_Address_Set(x, y, x + sizey - 1, y + sizey - 1);

            for(i = 0; i < TypefaceNum; i++)
            {
                for(j = 0; j < 8; j++)
                {
                    if(!mode)//�1�7�0�7�1�7�1�7�0�5�1�7�0�4
                    {
                        if(tfont16[k].Msk[i] & (0x01 << j))LCD_WR_DATA(fc);
                        else LCD_WR_DATA(bc);

                        m++;

                        if(m % sizey == 0)
                        {
                            m = 0;
                            break;
                        }
                    }
                    else//�1�7�1�7�1�7�0�5�1�7�0�4
                    {
                        if(tfont16[k].Msk[i] & (0x01 << j))	LCD_DrawPoint(x, y, fc); //�1�7�1�7�0�5�1�7�1�7�1�7�1�7

                        x++;

                        if((x - x0) == sizey)
                        {
                            x = x0;
                            y++;
                            break;
                        }
                    }
                }
            }
        }

        continue;  //�1�7�1�7�1�7�0�9�1�7�1�7�1�7�0�8�1�7�1�7�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7�1�7�0�3�1�7�1�7�1�7�1�7�1�7�0�9�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�6�1�7�0�0�0�0�1�7�1�7�1�7�1�7�0�8�1�7�1�7
    }
}
/**
************************************************************************
* @brief:      	LCD_ShowChinese24x24: �1�7�1�7LCD�1�7�1�7�1�7�1�7�0�524x24�1�7�1�7�1�7�1�7
* @param:      	x, y - �1�7�1�7�0�3�1�7�1�7�1�7�6�7�1�7�1�7�0�5�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�0�1�1�7�1�7�1�7�1�7�1�7
*              	s - �0�8�1�7�1�7�0�5�1�7�0�2�1�7�1�7�0�7�1�7�0�7�1�7�1�7�1�7�1�7�1�7�1�7�0�8�1�7�1�7�1�7�1�7�1�7�0�3�1�7
*              	fc - �1�7�1�7�1�7�1�7�1�7�1�7�0�2
*              	bc - �1�7�1�7�1�7�1�7�1�7�1�7�0�2
*              	sizey - �1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7���1�7�1�7�0�1�1�7�1�724x24
*              	mode - �1�7�1�7�0�5�0�0�0�4�1�7�1�71�1�7�1�7�0�5�1�7�1�7�0�2�1�7�1�70�1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7�1�7�0�5
* @retval:     	void
* @details:    	�1�7�1�7LCD�1�7�1�7�1�7�1�7�0�524x24�1�7�1�7�1�7�0�7�1�7�1�7�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�0�5�0�0�0�4�1�7�1�7
************************************************************************
**/
void LCD_ShowChinese24x24(unsigned short x, unsigned short y, unsigned char *s, unsigned short fc, unsigned short bc, unsigned char sizey, unsigned char mode)
{
    unsigned char i, j, m = 0;
    unsigned short k;
    unsigned short HZnum;//�1�7�1�7�1�7�1�7�1�7�1�7�0�7
    unsigned short TypefaceNum;//�0�5�1�7�1�7�1�7�0�7�1�7�1�7�1�7�0�8�1�7�0�3�1�0�1�7��
    unsigned short x0 = x;
    TypefaceNum = (sizey / 8 + ((sizey % 8) ? 1 : 0)) * sizey;
    HZnum = sizeof(tfont24) / sizeof(typFNT_GB24);	//�0�1�1�7�0�6�1�7�1�7�1�7�1�7�1�7�0�7

    for(k = 0; k < HZnum; k++)
    {
        if ((tfont24[k].Index[0] == *(s)) && (tfont24[k].Index[1] == *(s + 1)))
        {
            LCD_Address_Set(x, y, x + sizey - 1, y + sizey - 1);

            for(i = 0; i < TypefaceNum; i++)
            {
                for(j = 0; j < 8; j++)
                {
                    if(!mode)//�1�7�0�7�1�7�1�7�0�5�1�7�0�4
                    {
                        if(tfont24[k].Msk[i] & (0x01 << j))LCD_WR_DATA(fc);
                        else LCD_WR_DATA(bc);

                        m++;

                        if(m % sizey == 0)
                        {
                            m = 0;
                            break;
                        }
                    }
                    else//�1�7�1�7�1�7�0�5�1�7�0�4
                    {
                        if(tfont24[k].Msk[i] & (0x01 << j))	LCD_DrawPoint(x, y, fc); //�1�7�1�7�0�5�1�7�1�7�1�7�1�7

                        x++;

                        if((x - x0) == sizey)
                        {
                            x = x0;
                            y++;
                            break;
                        }
                    }
                }
            }
        }

        continue;  //�1�7�1�7�1�7�0�9�1�7�1�7�1�7�0�8�1�7�1�7�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7�1�7�0�3�1�7�1�7�1�7�1�7�1�7�0�9�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�6�1�7�0�0�0�0�1�7�1�7�1�7�1�7�0�8�1�7�1�7
    }
}
/**
************************************************************************
* @brief:      	LCD_ShowChinese32x32: �1�7�1�7LCD�1�7�1�7�1�7�1�7�0�532x32�1�7�1�7�1�7�1�7
* @param:      	x, y - �1�7�1�7�0�3�1�7�1�7�1�7�6�7�1�7�1�7�0�5�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�0�1�1�7�1�7�1�7�1�7�1�7
*              	s - �0�8�1�7�1�7�0�5�1�7�0�2�1�7�1�7�0�7�1�7�0�7�1�7�1�7�1�7�1�7�1�7�1�7�0�8�1�7�1�7�1�7�1�7�1�7�0�3�1�7
*              	fc - �1�7�1�7�1�7�1�7�1�7�1�7�0�2
*              	bc - �1�7�1�7�1�7�1�7�1�7�1�7�0�2
*              	sizey - �1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7���1�7�1�7�0�1�1�7�1�732x32
*              	mode - �1�7�1�7�0�5�0�0�0�4�1�7�1�71�1�7�1�7�0�5�1�7�1�7�0�2�1�7�1�70�1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7�1�7�0�5
* @retval:     	void
* @details:    	�1�7�1�7LCD�1�7�1�7�1�7�1�7�0�532x32�1�7�1�7�1�7�0�7�1�7�1�7�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�0�5�0�0�0�4�1�7�1�7
************************************************************************
**/
void LCD_ShowChinese32x32(unsigned short x, unsigned short y, unsigned char *s, unsigned short fc, unsigned short bc, unsigned char sizey, unsigned char mode)
{
    unsigned char i, j, m = 0;
    unsigned short k;
    unsigned short HZnum;//�1�7�1�7�1�7�1�7�1�7�1�7�0�7
    unsigned short TypefaceNum;//�0�5�1�7�1�7�1�7�0�7�1�7�1�7�1�7�0�8�1�7�0�3�1�0�1�7��
    unsigned short x0 = x;
    TypefaceNum = (sizey / 8 + ((sizey % 8) ? 1 : 0)) * sizey;
    HZnum = sizeof(tfont32) / sizeof(typFNT_GB32);	//�0�1�1�7�0�6�1�7�1�7�1�7�1�7�1�7�0�7

    for(k = 0; k < HZnum; k++)
    {
        if ((tfont32[k].Index[0] == *(s)) && (tfont32[k].Index[1] == *(s + 1)))
        {
            LCD_Address_Set(x, y, x + sizey - 1, y + sizey - 1);

            for(i = 0; i < TypefaceNum; i++)
            {
                for(j = 0; j < 8; j++)
                {
                    if(!mode)//�1�7�0�7�1�7�1�7�0�5�1�7�0�4
                    {
                        if(tfont32[k].Msk[i] & (0x01 << j))LCD_WR_DATA(fc);
                        else LCD_WR_DATA(bc);

                        m++;

                        if(m % sizey == 0)
                        {
                            m = 0;
                            break;
                        }
                    }
                    else//�1�7�1�7�1�7�0�5�1�7�0�4
                    {
                        if(tfont32[k].Msk[i] & (0x01 << j))	LCD_DrawPoint(x, y, fc); //�1�7�1�7�0�5�1�7�1�7�1�7�1�7

                        x++;

                        if((x - x0) == sizey)
                        {
                            x = x0;
                            y++;
                            break;
                        }
                    }
                }
            }
        }

        continue;  //�1�7�1�7�1�7�0�9�1�7�1�7�1�7�0�8�1�7�1�7�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7�1�7�0�3�1�7�1�7�1�7�1�7�1�7�0�9�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�6�1�7�0�0�0�0�1�7�1�7�1�7�1�7�0�8�1�7�1�7
    }
}
/**
************************************************************************
* @brief:      	LCD_ShowChar: �1�7�1�7LCD�1�7�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7�0�7�1�7
* @param:      	x, y - �1�7�1�7�0�3�1�7�1�7�1�7�6�7�1�7�1�7�0�5�1�7�0�7�1�7�1�7�1�7�1�7�1�7�1�7�0�1�1�7�1�7�1�7�1�7�1�7
*              	num - �0�8�1�7�1�7�0�5�1�7�1�7�1�7�0�7�1�7�1�7�1�7ASCII�1�7�1�7�0�5
*              	fc - �1�7�1�7�1�7�1�7�1�7�1�7�0�2
*              	bc - �1�7�1�7�1�7�1�7�1�7�1�7�0�2
*              	sizey - �1�7�1�7�1�7�1�7�1�7���1�7�1�7�0�1�1�7�1�712x6, 16x8, 24x12, 32x16
*              	mode - �1�7�1�7�0�5�0�0�0�4�1�7�1�71�1�7�1�7�0�5�1�7�1�7�0�2�1�7�1�70�1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7�1�7�0�5
* @retval:     	void
* @details:    	�1�7�1�7LCD�1�7�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7�0�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�0�5�0�0�0�4�1�7�0�0�1�7�0�4�1�7�1�7�1�7�1�7�1�7�1�7�1�7���1�7�1�7
************************************************************************
**/
void LCD_ShowChar(unsigned short x, unsigned short y, unsigned char num, unsigned short fc, unsigned short bc, unsigned char sizey, unsigned char mode)
{
    unsigned char temp, sizex, t, m = 0;
    unsigned short i, TypefaceNum; //�0�5�1�7�1�7�1�7�0�7�1�7�1�7�1�7�0�8�1�7�0�3�1�0�1�7��
    unsigned short x0 = x;
    sizex = sizey / 2;
    TypefaceNum = (sizex / 8 + ((sizex % 8) ? 1 : 0)) * sizey;
    num = num - ' '; //�1�7�0�1�1�7�0�1�1�7�0�6�1�7�1�7�0�5
    LCD_Address_Set(x, y, x + sizex - 1, y + sizey - 1); //�1�7�1�7�1�7���1�7�1�7�˄1�7�1�7

    for(i = 0; i < TypefaceNum; i++)
    {
        if(sizey == 12)temp = ascii_1206[num][i];		   //�1�7�1�7�1�7�1�76x12�1�7�1�7�1�7�1�7
        else if(sizey == 16)temp = ascii_1608[num][i];		 //�1�7�1�7�1�7�1�78x16�1�7�1�7�1�7�1�7
        else if(sizey == 24)temp = ascii_2412[num][i];		 //�1�7�1�7�1�7�1�712x24�1�7�1�7�1�7�1�7
        else if(sizey == 32)temp = ascii_3216[num][i];		 //�1�7�1�7�1�7�1�716x32�1�7�1�7�1�7�1�7
        else return;

        for(t = 0; t < 8; t++)
        {
            if(!mode)//�1�7�0�7�1�7�1�7�1�7�0�0�0�4
            {
                if(temp & (0x01 << t))LCD_WR_DATA(fc);
                else LCD_WR_DATA(bc);

                m++;

                if(m % sizex == 0)
                {
                    m = 0;
                    break;
                }
            }
            else//�1�7�1�7�1�7�1�7�0�0�0�4
            {
                if(temp & (0x01 << t))LCD_DrawPoint(x, y, fc); //�1�7�1�7�0�5�1�7�1�7�1�7�1�7

                x++;

                if((x - x0) == sizex)
                {
                    x = x0;
                    y++;
                    break;
                }
            }
        }
    }
}
/**
************************************************************************
* @brief:      	LCD_ShowString: �1�7�1�7LCD�1�7�1�7�1�7�1�7�0�5�1�7�0�7�1�7�1�7�1�7
* @param:      	x, y - �1�7�1�7�0�3�1�7�1�7�1�7�6�7�1�7�1�7�0�5�1�7�0�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�1�1�7�1�7�1�7�1�7�1�7
*              	p - �0�8�1�7�1�7�0�5�1�7�1�7�1�7�0�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7'\0'�1�7�1�7��
*              	fc - �1�7�1�7�1�7�1�7�1�7�1�7�0�2
*              	bc - �1�7�1�7�1�7�1�7�1�7�1�7�0�2
*              	sizey - �1�7�1�7�1�7�1�7�1�7���1�7�1�7�0�1�1�7�1�712x6, 16x8, 24x12, 32x16
*              	mode - �1�7�1�7�0�5�0�0�0�4�1�7�1�71�1�7�1�7�0�5�1�7�1�7�0�2�1�7�1�70�1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7�1�7�0�5
* @retval:     	void
* @details:    	�1�7�1�7LCD�1�7�1�7�1�7�1�7�0�5�1�7�0�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�0�5�0�0�0�4�1�7�0�0�1�7�0�4�1�7�1�7�1�7�1�7�1�7�1�7�1�7���1�7�1�7
************************************************************************
**/
void LCD_ShowString(unsigned short x, unsigned short y, const unsigned char *p, unsigned short fc, unsigned short bc, unsigned char sizey, unsigned char mode)
{
    while(*p != '\0')
    {
        LCD_ShowChar(x, y, *p, fc, bc, sizey, mode);
        x += sizey / 2;
        p++;
    }
}
/**
************************************************************************
* @brief:      	mypow: �1�7�1�7�1�7�1�7m�1�7�1�7n�1�7�Ǆ1�7
* @param:      	m - �1�7�1�7�1�7�1�7
*              	n - �0�8�1�7�1�7
* @retval:     	uint32_t - m�1�7�1�7n�1�7�Ǆ1�7
* @details:    	�1�7�1�7�1�7�1�7m�1�7�1�7n�1�7�Ǆ1�7�1�7�1�7�1�7�1�7�1�7�1�1�1�7�1�7�1�7�1�7
************************************************************************
**/
uint32_t mypow(unsigned char m, unsigned char n)
{
    uint32_t result = 1;

    while(n--)result *= m;

    return result;
}
/**
************************************************************************
* @brief:      	LCD_ShowIntNum: �1�7�1�7LCD�1�7�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7
* @param:      	x - x�1�7�1�7�1�7�1�7
*              	y - y�1�7�1�7�1�7�1�7
*              	num - �0�8�1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7�1�7
*              	len - �1�7�1�7�1�7�1�7�1�7�1�7�0�5�1�7�1�7�˄1�7�1�7
*              	fc - �1�7�1�7�1�7�1�7�1�7�1�7�0�2
*              	bc - �1�7�1�7�1�7�1�7�1�7�1�7�0�2
*              	sizey - �1�7�1�7�1�7�1�7�1�7��
* @retval:     	void
* @details:    	�1�7�1�7LCD�1�7�1�7�1�7�1�7�0�5�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�7�1�7�0�1�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�5�1�7�1�7�˄1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�2�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�2�1�7�1�7�1�7�1�7�1�7�1�7�1�7���1�7�1�7
************************************************************************
**/
void LCD_ShowIntNum(unsigned short x, unsigned short y, unsigned short num, unsigned char len, unsigned short fc, unsigned short bc, unsigned char sizey)
{
    unsigned char t, temp;
    unsigned char enshow = 0;
    unsigned char sizex = sizey / 2;

    for(t = 0; t < len; t++)
    {
        temp = (num / mypow(10, len - t - 1)) % 10;

        if(enshow == 0 && t < (len - 1))
        {
            if(temp == 0)
            {
                LCD_ShowChar(x + t * sizex, y, ' ', fc, bc, sizey, 0);
                continue;
            }
            else enshow = 1;

        }

        LCD_ShowChar(x + t * sizex, y, temp + 48, fc, bc, sizey, 0);
    }
}
/**
************************************************************************
* @brief:      	LCD_ShowFloatNum: �1�7�1�7LCD�1�7�1�7�1�7�1�7�0�5�1�7�1�7�0�4�1�7�1�7�1�7�0�0�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�1�1�7�0�8�1�7�1�7�1�7
* @param:      	x - x�1�7�1�7�1�7�1�7
*              	y - y�1�7�1�7�1�7�1�7
*              	num - �0�8�1�7�1�7�0�5�1�7�0�0�1�7�1�7�1�7�1�7�1�7
*              	len - �1�7�1�7�1�7�1�7�˄1�7�1�7
*              	decimal - ���1�7�1�7�˄1�7�1�7
*              	fc - �1�7�0�5�1�7�1�7�1�7�0�2
*              	bc - �1�7�1�7�1�7�1�7�1�7�1�7�0�2
*              	sizey - �1�7�1�7�1�7�1�7�1�7��
* @retval:     	void
* @details:    	�1�7�1�7LCD�1�7�1�7�1�7�1�7�0�5�1�7�1�7�0�4�1�7�1�7�1�7�0�0�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�1�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�˄1�7�1�7�1�7�1�7���1�7�1�7�˄1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�2�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�2�1�7�1�7�1�7�1�7�1�7�1�7�1�7���1�7�1�7
************************************************************************
**/
void LCD_ShowFloatNum(unsigned short x, unsigned short y, float num, unsigned char len, unsigned char decimal, unsigned short fc, unsigned short bc, unsigned char sizey)
{
    int16_t num_int;
    unsigned char t, temp, sizex;
    sizex = sizey / 2;
    num_int = num * mypow(10, decimal);

    if (num < 0)
    {
        LCD_ShowChar(x, y, '-', fc, bc, sizey, 0);
        num_int = -num_int;
        x += sizex;
        len++;
    }
    else
    {
        LCD_ShowChar(x, y, ' ', fc, bc, sizey, 0);
        num_int = num_int;
        x += sizex;
        len++;
    }

    // �1�7�1�4�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�2�0�6�1�7�1�7�1�7�1�7�0�5�1�7�1�7�˄1�7�1�7
    LCD_Fill(x, y, x + len * sizex + decimal + 1, y + sizey + 1, bc);

    for (t = 0; t < len; t++)
    {
        if (t == (len - decimal))
        {
            LCD_ShowChar(x + (len - decimal) * sizex, y, '.', fc, bc, sizey, 0);
            t++;
            len += 1;
        }

        temp = ((num_int / mypow(10, len - t - 1)) % 10) + '0';
        LCD_ShowChar(x + t * sizex, y, temp, fc, bc, sizey, 0);
    }
}
/**
************************************************************************
* @brief:      	LCD_ShowFloatNum1: �1�7�1�7LCD�1�7�1�7�1�7�1�7�0�5�1�7�1�7�0�4�1�7�1�7�1�7�0�0�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�1�1�7�0�8�1�7�1�7�1�7
* @param:      	x - x�1�7�1�7�1�7�1�7
*              	y - y�1�7�1�7�1�7�1�7
*              	num - �0�8�1�7�1�7�0�5�1�7�0�0�1�7�1�7�1�7�1�7�1�7
*              	len - �1�7�1�7�1�7�1�7�˄1�7�1�7
*              	decimal - ���1�7�1�7�˄1�7�1�7
*              	fc - �1�7�0�5�1�7�1�7�1�7�0�2
*              	bc - �1�7�1�7�1�7�1�7�1�7�1�7�0�2
*              	sizey - �1�7�1�7�1�7�1�7�1�7��
* @retval:     	void
* @details:    	�1�7�1�7LCD�1�7�1�7�1�7�1�7�0�5�1�7�1�7�0�4�1�7�1�7�1�7�0�0�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�1�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�˄1�7�1�7�1�7�1�7���1�7�1�7�˄1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�2�1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�2�1�7�1�7�1�7�1�7�1�7�1�7�1�7���1�7�1�7
************************************************************************
**/
void LCD_ShowFloatNum1(unsigned short x, unsigned short y, float num, unsigned char len, unsigned char decimal, unsigned short fc, unsigned short bc, unsigned char sizey)
{
    int16_t num_int;
    unsigned char t, temp, sizex;
    sizex = sizey / 2;
    num_int = num * mypow(10, decimal);


    num_int = num_int;
    x += sizex;
    len++;

    // �1�7�1�4�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�2�0�6�1�7�1�7�1�7�1�7�0�5�1�7�1�7�˄1�7�1�7
    LCD_Fill(x, y, x + len * sizex + decimal + 1, y + sizey + 1, bc);

    for (t = 0; t < len; t++)
    {
        if (t == (len - decimal))
        {
            LCD_ShowChar(x + (len - decimal) * sizex, y, '.', fc, bc, sizey, 0);
            t++;
            len += 1;
        }

        temp = ((num_int / mypow(10, len - t - 1)) % 10) + '0';
        LCD_ShowChar(x + t * sizex, y, temp, fc, bc, sizey, 0);
    }
}
/**
************************************************************************
* @brief:      	LCD_ShowPicture: �1�7�1�7LCD�1�7�1�7�1�7�1�7�0�5�0�0�0�2
* @param:      	x - x�1�7�1�7�1�7�1�7
*              	y - y�1�7�1�7�1�7�1�7
*              	length - �1�7�1�7�1�7�1�7
*              	width - �1�7�1�7
*				pic[] - �0�0�0�2�1�7�1�7�1�7�1�7
* @retval:     	void
* @details:    	�1�7�1�7LCD�1�7�1�7�1�7�1�7�0�5�0�0�0�2
************************************************************************
**/
void LCD_ShowPicture(unsigned short x, unsigned short y, unsigned short length, unsigned short width, const unsigned char pic[])
{
    unsigned short i, j;
    uint32_t k = 0;
    LCD_Address_Set(x, y, x + length - 1, y + width - 1);

    for(i = 0; i < length; i++)
    {
        for(j = 0; j < width; j++)
        {
            LCD_WR_DATA8(pic[k * 2]);
            LCD_WR_DATA8(pic[k * 2 + 1]);
            k++;
        }
    }
}
/**
************************************************************************
* @brief:      	LCD_Init: LCD�1�7�1�7�0�3�1�7�1�7�1�7�1�7�1�7�1�7
* @param:      	void
* @details:    	�0�4�1�7�1�7LCD�1�7�0�5�1�7�0�3�1�7�1�7�1�7�1�7�1�7�0�1�1�7�1�7�1�7�1�7�1�7�1�7�1�7�˄1�7�1�7�1�7�1�7�1�7�1�7�1�7�1�7�0�1�1�7�1�7�0�6�1�7�1�7�1�7�1�7�1�7�1�7�0�1�1�7
* @retval:     	void
************************************************************************
**/
void LCD_Init(void)
{
    LCD_RES_Clr();//�1�7�1�7��
    
    Delay_ms(100);
    LCD_RES_Set();
    Delay_ms(100);

    //LCD_BLK_Set();//�1�7�1�7�1�7�1�7�1�7
    Delay_ms(100);

    LCD_WR_REG(0x11);
    Delay_ms(120);
    LCD_WR_REG(0x36);

    if(USE_HORIZONTAL == 0)LCD_WR_DATA8(0x00);
    else if(USE_HORIZONTAL == 1)LCD_WR_DATA8(0xC0);
    else if(USE_HORIZONTAL == 2)LCD_WR_DATA8(0x70);
    else LCD_WR_DATA8(0xA0);

    LCD_WR_REG(0x3A);
    LCD_WR_DATA8(0x05);

    LCD_WR_REG(0xB2);
    LCD_WR_DATA8(0x0C);
    LCD_WR_DATA8(0x0C);
    LCD_WR_DATA8(0x00);
    LCD_WR_DATA8(0x33);
    LCD_WR_DATA8(0x33);

    LCD_WR_REG(0xB7);
    LCD_WR_DATA8(0x35);

    LCD_WR_REG(0xBB);
    LCD_WR_DATA8(0x19);

    LCD_WR_REG(0xC0);
    LCD_WR_DATA8(0x2C);

    LCD_WR_REG(0xC2);
    LCD_WR_DATA8(0x01);

    LCD_WR_REG(0xC3);
    LCD_WR_DATA8(0x12);

    LCD_WR_REG(0xC4);
    LCD_WR_DATA8(0x20);

    LCD_WR_REG(0xC6);
    LCD_WR_DATA8(0x0F);

    LCD_WR_REG(0xD0);
    LCD_WR_DATA8(0xA4);
    LCD_WR_DATA8(0xA1);

    LCD_WR_REG(0xE0);
    LCD_WR_DATA8(0xD0);
    LCD_WR_DATA8(0x04);
    LCD_WR_DATA8(0x0D);
    LCD_WR_DATA8(0x11);
    LCD_WR_DATA8(0x13);
    LCD_WR_DATA8(0x2B);
    LCD_WR_DATA8(0x3F);
    LCD_WR_DATA8(0x54);
    LCD_WR_DATA8(0x4C);
    LCD_WR_DATA8(0x18);
    LCD_WR_DATA8(0x0D);
    LCD_WR_DATA8(0x0B);
    LCD_WR_DATA8(0x1F);
    LCD_WR_DATA8(0x23);

    LCD_WR_REG(0xE1);
    LCD_WR_DATA8(0xD0);
    LCD_WR_DATA8(0x04);
    LCD_WR_DATA8(0x0C);
    LCD_WR_DATA8(0x11);
    LCD_WR_DATA8(0x13);
    LCD_WR_DATA8(0x2C);
    LCD_WR_DATA8(0x3F);
    LCD_WR_DATA8(0x44);
    LCD_WR_DATA8(0x51);
    LCD_WR_DATA8(0x2F);
    LCD_WR_DATA8(0x1F);
    LCD_WR_DATA8(0x1F);
    LCD_WR_DATA8(0x20);
    LCD_WR_DATA8(0x23);

    LCD_WR_REG(0x21);

    LCD_WR_REG(0x29);
}

void Delay_ms(unsigned short timer)
{
    unsigned int i,j;
    for(i=0;i<timer;i++)
    {
        for(j=0;j<8020;j++)
        {;}
    }
}
/*******************Copyright (c) ZFSZDZ ******END OF FILE************/
